Image processing for classification and segmentation of rock samples

ABSTRACT

The present invention relates to method for processing an image, said image representing a rock sample. The method comprises receiving said image; for each current threshold value in a plurality of threshold values determining a threshold image, the threshold image having pixels associated with a first color value or a second color value, the determination of the threshold image being based on the received image and the current threshold; and for each current connected set of pixels associated with the first color value in the threshold image, determining a connected volume or a connected surface area of said current connected set of pixels. In addition, the method comprises determining numbers of connected sets of pixels associated with the first color value for a plurality of connected volumes or connected surface areas and for a plurality of thresholds.

RELATED APPLICATIONS

The present application is a National Phase entry of PCT Application No.PCT/IB2013/002625, filed Nov. 7, 2013, which claims priority from EPPatent Application No. 12306381.0, filed Nov. 8, 2012, said applicationsbeing hereby incorporated by reference herein in their entirety.

BACKGROUND OF THE INVENTION

The present invention relates to image analysis and especially for imagerepresenting a rock in order to determine rock geophysical properties ata microscopic level.

The approaches described in this section could be pursued, but are notnecessarily approaches that have been previously conceived or pursued.Therefore, unless otherwise indicated herein, the approaches describedin this section are not prior art to the claims in this application andare not admitted to be prior art by inclusion in this section.Furthermore, all embodiments are not necessarily intended to solve allor even any of the problems brought forward in this section.

Determining geophysical properties and petro-elastic properties of thesubsoil is important for geologists and engineers to create relevantmodels of petroleum or gas reservoirs.

This determination may be performed by obtaining an image (2D or 3Dimage, gray scale color image most of the time) of a piece of rocksobtained through core samples. Micro computed tomography methods may beused in order to such images (or MCT image): micro-scan method or FIPSbeam method for instance.

A core plug may be considered to be solid comprising at least one matrix(normally a single matrix) with pores embedded in it.

Once this image is obtained, it is possible to “binarize” the image.

This step of gray scale binarization is very important as it determinesthe quality and the reliability of the rock properties computed from theMCT image.

Binarization is achieved by defining a threshold value that divide“grain-associated” gray scale values from the “pore-associated” grayscale values. Binarization comprises creating a new two colors image(white and black for instance), points of the new image corresponding topoints of the initial image below a given threshold being white (andthus associated with pores for instance), points of the new imagecorresponding to points of the initial image above the given thresholdbeing black (and thus associated with grain for instance).

If the threshold value is too low, the image pore space is underestimated and if the threshold value is too high, the image pore spaceis over estimated. Consequently, the geophysical properties of the rockare erroneous if the threshold value is not adequate.

Thus the determination of the adequate value of the threshold is highlyimportant and there is a need for a correct determination.

Some practitioner may determine a lab measured porosity of a rock sampleand try to obtain the same porosity by modifying the threshold. Thismethod does not provide accurate result as the porosity of a rock samplemay change significantly from one part of a sample to another part ofthe sample. At the very least, this method is very complex to enable ifaccurate result is needed. In addition, this method lacks physicalbasis: for example, it does not guarantee the continuity and thereforethe uniqueness of the matrix (the grain-part of the rock sample) butonly the porosity value of the rock sample.

There is thus a need for a method that provides accurate and adequatedetermination of the threshold to provide adequate geophysicalproperties and/or to guarantee continuity in the matrix of the rocksample.

SUMMARY OF THE INVENTION

The invention relates to a method for processing an image, said imagerepresenting a rock sample. The method comprises:

-   -   /a/ receiving said image;    -   for each current threshold value in a plurality of threshold        values:        -   /b/ determining a threshold image, the threshold image            having pixels associated with a first color value or a            second color value, the determination of the threshold image            being based on the received image and the current threshold;        -   /c/ for each current connected set of pixels associated with            the first color value in the threshold image, determining a            connected size of said current connected set of pixels;        -   /d/ determining at least one number of connected sets of            pixels associated with the first color value, said connected            sets having a same connected size.

Therefore, a first histogram CC_(P)[i,j] may be computed based on thedetermined number of step /d/. CC_(P)[i,j] is a function of i the valueof the current threshold value (i can take all value in the plurality ofthreshold values) and j an index that represents a connected size (or aninterval of connected sizes). In addition, the index j may alsorepresent an interval of size or a set of size value. The value of thehistogram CC_(P)[i,j] for a given i and j is the determined numbers ofconnected sets of pixels associated with the first color value for theconnected size(s) j and for the threshold i (i.e. in a threshold imagecomputed from the received image and with the threshold i).

A determined number of connected sets of pixels may represent a singlepoint in the first histogram CC_(P)[i,j]. It is possible to reiteratestep /d/ for a plurality of different connected sizes and for aplurality of threshold value.

A color value is only a value that may be represented as a color forgraphical representation. For instance, a color value may be a string(e.g. “red”), a complex number (e.g. “0xFF56A3”), a simple integer (e.g.“3”), a Boolean value (e.g. “true”), etc. Any representations of a colorvalue are possible.

A connected set of pixels may comprise only a single pixel. All pixelsof the connected set of pixels are adjacent. No adjacent pixel (i.e.pixel that is not in this set of pixels and adjacent to at least onepixel of this set) is associated with the first color value.

Two pixels are adjacent if at least one point (respectively edge orface) is shared by these two pixels.

A size may be, for instance, a volume value or a surface area.

The connected size (i.e. the connected volume (3D case) or the connectedsurface area (2D case)) is the volume/surface area of the connected set.This size may be expressed in m³ or in m² but may also be expressed invoxel (i.e. a volume element, representing a value on a regular grid inthree dimensional space, such as a 3D pixel) or texel/pixmap (i.e. asurface element, representing a value on a regular grid in twodimensional space, such as a 2D pixel).

In addition, in the determination of step /d/, each set in said sets ofpixels may have a connected size higher than a predetermined size. Themethod may further comprise:

-   -   /e/ determining a target threshold value based on the determined        numbers of connected sets of pixels having a connected size        higher than a predetermined size.

Thus, for instance, it is possible to determine a curve based on thedetermined numbers of connected sets of pixels. The determined numberrepresents, for a given threshold, the number of sets that are biggerthan a predetermined size.

Thanks to that curve, it is possible to determine a target thresholdvalue. For instance, the target threshold represents a zone in thatcurve where the curve significantly increases.

In a possible embodiment, the determination of the target thresholdvalue may be based on a derivative of the determined numbers ofconnected sets of pixels having a connected size higher than thepredetermined size.

In a possible embodiment, the received image comprising pixelsassociated with a set of pixel color values, the method may furthercomprise:

-   -   /g/ for each current color value in the set of pixel color        values, determining a number of pixels in the pixels of the        received image associated with said current color value;    -   for each current threshold value in a plurality of threshold        values        -   /c′/for each current connected set of pixels associated with            the second color value in the threshold image, determining a            connected size of said current connected set of pixels;        -   /d′/determining at least one number of connected sets of            pixels associated with the second color value, said            connected sets having a same connected size.

The determined numbers of pixels associated with said current value mayenable a second histogram (h_(GS)(i) representing the number (or theratio) of pixels in the prepared input image associated with a colorvalue i).

The determination of numbers of connected sets of pixels associated withthe second color value for a plurality of connected sizes and for aplurality of thresholds may provide a third histogram (CC_(M)[i,j]representing the number (or ratio) of connected sets of pixelsassociated with the second color value of size j when the prepared inputimage is binarized or threshold with the threshold value equal to i).

The first, the second and the third histograms may create a texturemodel that may be used for:

-   -   classifying the rock sample,    -   determining very easily petro/geo physical properties of the        rock sample,    -   etc.

A second aspect relates to a computer program product comprising acomputer readable medium, having thereon a computer program comprisingprogram instructions. The computer program is loadable into adata-processing unit and adapted to cause the data-processing unit tocarry out the method described above when the computer program is run bythe data-processing unit.

A third aspect relates to a device for processing an image, said imagerepresenting a rock sample. The device comprises:

-   -   an input interface for receiving said image;    -   a circuit for, for each current threshold value in a plurality        of threshold values:        -   determining a threshold image, the threshold image having            pixels associated with a first color value or a second color            value, the determination of the threshold image being based            on the received image and the current threshold;        -   for each current connected set of pixels associated with the            first color value in the threshold image, determining a            connected size of said current connected set of pixels;        -   determining at least one number of connected sets of pixels            associated with the first color value, each set in the sets            of pixels having a connected size in at least one determined            connected sizes.

Other features and advantages of the method and apparatus disclosedherein will become apparent from the following description ofnon-limiting embodiments, with reference to the appended drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example, and not by wayof limitation, in the figures of the accompanying drawings, in whichlike reference numerals refer to similar elements and in which:

FIG. 1a is a possible 2D micro computed tomography image of a rock;

FIG. 1b to 1d are threshold images of the image of FIG. 1a for differentvalues of a threshold;

FIG. 2a is a histogram of numbers of connected sets of pixels per volumeand per threshold value;

FIGS. 2b to 2c are examples of possible method to compute a relevantthreshold value in order to compute a porosity value;

FIG. 3 is a flow chart describing a possible embodiment of the presentinvention;

FIG. 4 is a possible embodiment for a device that enables the presentinvention.

DETAILED DESCRIPTION OF THE DRAWINGS

FIG. 1a is a possible 2D micro computed tomography image of a rock (or aslice of a 3D micro computed tomography image of a rock sample).

This image 100 may be obtained from of a piece of rocks (a core plug,for instance). A tomography method may be used in order to gain accessto the internal structure of the piece of rocks.

The image comprises 2D pixels associated with a color value in a colorscale. For instance, the color scale may be a gray color scalecomprising integer values in the interval [0.255]. If the color formatof the image is RGB, the color value of a pixel is [n,n,n] with n in theinterval [0.255].

The image resolution is the resolution of a pixel of this image (i.e.the edge of each pixel) and may be about 0.3 μm-19 μm.

FIGS. 1b to 1d are threshold images of the image of FIG. 1a fordifferent values of a threshold.

A threshold image is an image in which the pixels may only be associatedwith a value in two color values. If most of the time, the two colorvalues are chosen to be black and white, these two color values may bearbitrarily chosen:

-   -   1 and 0;    -   “red” and “green”;    -   etc.

A threshold image is computed from an input image and from a giventhreshold value, this given threshold value being (in a possibleembodiment) between the two extreme values of the possible color valuesof pixels in the input image. For instance, if the possible color valuesof pixels in the input image are between 0 and 255, it is possible tochoose the threshold value equal to 107.

To obtain the threshold image, each pixels of the input image isanalyzed and:

-   -   if this latter pixel has an associated color value below the        threshold value, the corresponding pixel of the threshold image        is associated with one of the two possible colors;    -   if this latter pixel has an associated color value above the        threshold value, the corresponding pixel of the threshold image        is associated with the other color in the two possible colors.

For instance, FIG. 1b is a threshold image for the input image of FIG.1a and for a low threshold value (e.g. threshold 50 while the colorvalue is in [0.255]): the white part 101 b prevails over the black part101 a.

FIG. 1c is a threshold image for the input image of FIG. 1a and for amiddle threshold value (e.g. threshold 123 while the color value is in[0.255]): the white part 102 b and the black part 102 a are equivalent.

FIG. 1d is a threshold image for the input image of FIG. 1a and for ahigh threshold value (e.g. threshold 200 while the color value is in[0,255]): the black part 103 a prevails over the white part 103 b.

FIG. 2a is a histogram of numbers of connected sets of pixels associatedwith a given color value per volume, per threshold value, and for agiven image.

A connected set of pixels associated with color C is a set of pixels inthe image that are associated with the same color C and are adjacent(i.e. two pixels being adjacent if they share either a point, or an edgea face). Advantageously, no other connected set of pixels comprisesanother connected set of pixels (i.e. each connected set of pixels ismaximal, said set being only adjacent to pixels of a color differentfrom C).

Each point of the histogram 200 is associated with a number value. Forinstance, for the point 207 with coordinates (Th₁;V₁) in the histogram,the number value corresponds to the number of connected sets of pixelsverifying the following conditions:

-   -   the given image is threshold with a threshold value of Th₁;    -   pixels in a connected set of pixels of the threshold image is        associated with a given color value (e.g. black color value);    -   the connected set of pixels of the threshold image do not have        any pixel adjacent to this set and associated with the given        color value (i.e. the connected set of pixels is maximal);    -   the size of the connected set of pixels of the threshold image        is V₁ (or is in the interval [V₁−ΔV₁V₁+ΔV] with ΔV a        predetermined interval value). This size maybe expressed in m³        or in m² but may also be expressed in voxel (i.e. a volume        element, representing a value on a regular grid in three        dimensional space, such as a 3D pixel) or texel/pixmap (i.e. a        surface element, representing a value on a regular grid in two        dimensional space, such as a 2D pixel).

It is also possible that the number value is not related to a singlesize value (such as V₁) or a narrow size interval (such as[V₁−ΔV₁V₁+ΔV]). It is possible that the number value is related to sizesthat are higher to a predetermined value M_(V). For instance, points onthe line 210 of this histogram 200 is associated with number values thatcorresponds to the number of connected sets of pixels having a size in[M_(V)1+∞]. Thus, for instance, for the point 209 with coordinates(Th₂;M_(V)) in the histogram, the number value corresponds to the numberof connected sets of pixels verifying the following conditions:

-   -   the given image is threshold with a threshold value of Th₁;    -   pixels in a connected set of pixels of the threshold image is        associated with a given color value (e.g. black color value);    -   the connected set of pixels of the threshold image do not have        any pixel adjacent to this set and associated with the given        color value (i.e. the connected set of pixels is maximal);    -   the size of the connected set of pixels of the threshold image        is in [M_(V)1+∞].

If the number value associated with each point of the histogram may becomputed independently from the other points, it is possible to identifysome trends in the histogram.

For instance:

-   -   Zone 201 (below curve 201 s and above the axis Th) may comprise        points for which the associated number value is above 1000 (i.e.        more than 1000 sets of pixels for each point of this zone).    -   Zone 202 (below curve 202 s and above curve 201 s) may comprise        points for which the associated number value is above 750 and        below 1000 (i.e. more than 750 but less than 1000 sets of pixels        for each point of this zone).    -   Zone 203 (below curve 203 s and above curve 202 s) may comprise        points for which the associated number value is above 500 and        below 750 (i.e. more than 500 but less than 750 sets of pixels        for each point of this zone).    -   Zone 204 (below curve 204 s and above curve 203 s) may comprise        points for which the associated number value is above 250 and        below 500 (i.e. more than 250 but less than 500 sets of pixels        for each point of this zone).    -   Zone 205 (below curve 205 s and above curve 204 s) may comprise        points for which the associated number value is above 50 and        below 250 (i.e. more than 50 but less than 250 sets of pixels        for each point of this zone).    -   Zone 206 (below the line 210 and above curve 205 s) may comprise        points for which the associated number value is above 0 and        below 50 (i.e. less than 50 sets of pixels for each point of        this zone).    -   Line 210 represents the sets greater than the predetermined        value M_(V).

Curve 201 s (respectively 202 s, 203 s, 204 s and 205 s) is a curve thatcreates a delimitation between points of the histogram with anassociated number value greater than 1000 (respectively 750, 500, 250and 50) and points of the histogram with an associated number valuelesser than 1000 (respectively 750, 500, 250 and 50). Theses curves maybe approximated based on a polynomial regression or on any types ofregression.

FIGS. 2b to 2c are examples of possible method to compute arelevant/adequate threshold value as described above.

The curve 210 represents the number of sets having a size greater thanthe predetermined value M_(V) (see FIG. 2a ). The abscissa axis T_(h)represents the axis of the threshold value (like the abscissa of FIG. 2a) but the ordinate axis N_(supMV) represents the number of sets ofgreater size (i.e. greater than M_(V), see line 210 in FIG. 2a )

In order to determine a relevant threshold (i.e. that may be used toapproximate, for instance, the porosity of the rock sample or any othergeophysical properties), a number of methods may be used. The relevantthreshold value is a value that is in a zone of the curve 210 where thenumber of sets increases significantly (i.e. zone 208). Indeed, thisthreshold is characterized by the fact that the matrix part of the rocksample is in one master part: if the number of big sets is too high, theprobability that the rock sample should fall apart increases.

This relevant threshold value may be picked manually by an operator asthe computed curve 210 provides an easy and visual mean to determinesuch zone 208.

Nevertheless, it is also possible to use deterministic methods to selectthe relevant threshold value.

A first possible method is illustrated with FIG. 2b . In this method,the following steps are executed:

-   -   computing derivative values for points of the current curve    -   determining an abscissa value (Th_(210a)) for which the        derivative value is maximum (or higher than a predetermined        value) in the computed derivative values;    -   determining an intersection (Th_(210a′)) between an abscissa        axis (e.g. axis Th) and the derivative line (e.g. 201 d) at said        determined abscissa value (Th_(210a)) for said current curve        210.

Th_(210a) or Th_(210a′) may be used as the relevant threshold.

A second possible method is illustrated with FIG. 2c . In this method,the following steps are executed:

-   -   determining an abscissa value (Th_(210b)) for which the curve        210 is locally greater than a predetermined value (N_(Th)).

FIG. 3 is a flow chart describing a possible embodiment of the presentinvention. Part of this flow chart can represent steps for an example ofa computer program.

When receiving a 3D input image (300 i), it is possible to prepare theinput image (step 300) for the next steps of the processing. Thispreparation may be a conversion of the image in a specific/predeterminedformat (e.g. grayscale color, given resolution, etc.).

If a possible threshold value has not been used for processing theprepared input image (test 301, output OK, all possible threshold valuesmay be stored in a database 302 or may be provided by an operator by aninput interface), the prepared input image is threshold based on thepossible threshold value as described in relation of FIGS. 1a to 1 d.

In this embodiment, the 3D threshold image has two colors values: black(for the matrix portion of the image) and white (for the pore portion ofthe image).

It is then possible to determine a connected size of each connected setof white pixels in the threshold image (step 304). Thus, it is possibleto determine (step 305) a plurality of numbers of connected sets ofwhite pixels:

-   -   for a plurality of sizes (e.g. 4 connected sets of white pixels        having a size of 56 voxels, 15 connected sets of white pixels        having a size of 57 voxels, 18 connected sets of white pixels        having a size of 57 voxels, etc.); or    -   for a plurality of size intervals (e.g. 25 connected sets of        white pixels having a volume of 50-55 voxels, 53 connected sets        of white pixels having a volume of 56-60 voxels, 85 connected        sets of white pixels having a volume of 61-65 voxels, 1000        connected sets of white pixels having a volume greater than 70,        etc.).

In fact, this last determination enables the initialization of onevertical line (i.e. parallel to the axis CBV, see FIG. 2a ) of ahistogram associated with white color value.

It is also possible to determine a connected volume of each connectedset of black pixels in the threshold image (step 306). Thus, it ispossible to determine (step 307) a plurality of numbers of connectedsets of black pixels:

-   -   for a plurality of sizes (e.g. 20 connected sets of black pixels        having a volume of 33 voxels, 10 connected sets of white pixels        having a volume of 34 voxels, 52 connected sets of white pixels        having a volume of 35 voxels, etc.).    -   for a plurality of size intervals (e.g. 19 connected sets of        black pixels having a volume of 40-45 voxels, 20 connected sets        of black pixels having a volume of 46-50 voxels, 150 connected        sets of black pixels having a volume of 51-55 voxels, 100        connected sets of black pixels having a volume greater than 70,        etc.).

In fact, this last determination enables the initialization of onevertical line (i.e. parallel to the axis CBV, see FIG. 2a ) of ahistogram associated with black color value.

If all possible threshold values have been used for processing theprepared input image (test 301, output KO), the histograms (onehistogram associated with white color and one histogram associated withblack color) are finalized (step 308).

These finalizations comprise the concatenation of all vertical linesdetermined in steps 304-305 and 306-307 (each vertical lines beingordered, for each color, according to the threshold values used toobtain the threshold image).

Once the histogram is computed, it is possible to determine an adequatethreshold value (step 309), for instance as described in relation ofFIGS. 2b to 2c . This “adequate” threshold value is used to determine an“adequate” threshold image (being a threshold image of the preparedinput image with the adequate threshold value as threshold value).

The “adequate” threshold image may be used to determine a porosity value(step 310) by computing the ratio of the white volume in the image (i.e.the pore portion) over the total volume (i.e. the pore portion and thematrix portion). In addition, a permeability value in a given directionmay be computed via simulation/mathematical algorithm assuming that thewhite pixels of the “adequate” threshold image represent void portionand the black pixels of the “adequate” threshold image represent matrixportion.

It may be advantageous to also compute a histogram of grayscale values(step 311). This histogram h_(GS)(i) is a 2D histogram that represents anumber of pixels having a given grayscale value i.

Indeed, this histogram combined with the previous computed histograms(step 308) may define a texture model of the rock sample represented bythe image 300 i. This texture model comprises three components:

-   -   a grayscale histogram h_(GS)(i) representing the number (or        ratio) of pixels in the prepared input image associated with a        color value i (grayscale);    -   a pores connected histogram CC_(P)[i,j] representing the number        (or ratio) of connected sets of white pixels of size j when the        prepared input image is binarized or threshold with the        threshold value equal to i; and    -   a matrix connected histogram CC_(M)[i,j] representing the number        (or ratio) of connected sets of black pixels of size j when the        prepared input image is binarized or threshold with the        threshold value equal to i.

The three histograms are complementary:

-   -   the first histogram contains the first order statistic and its        shape provides many indications on the characteristics of the        input image (level of contrast, mono or bimodal shape indicating        whether the image is easy or not to be segmented),    -   the second and third histograms provide a description of the        spatial distribution of the grayscale within the input image        providing many petro/geo physical characteristics of the sample.

This texture model comprising the three histograms may be stored (step312) in a database for future use.

Then it is possible to extrapolate texture to larger sample scales (step313) based on that stored model.

In addition, it is possible, from a texture model to determine directlypetro/geo physical measurements. For instance, it is possible to usemathematical methods (as described above) but they often are complex tosolve. Advantageously, it is possible to use neural networks (forinstance, Hall et al, 1996, and Jouini et al, 2008) to createconnections relationship between texture parameters and petro/geophysical properties.

FIG. 4 is a possible embodiment for a device that enables the presentinvention.

In this embodiment, the device 400 comprise a computer, this computercomprising a memory 405 to store program instructions loadable into acircuit and adapted to cause circuit 404 to carry out the steps of thepresent invention when the program instructions are run by the circuit404.

The memory 405 may also store data and useful information for carryingthe steps of the present invention as described above.

The circuit 404 may be for instance:

-   -   a processor or a processing unit adapted to interpret        instructions in a computer language, the processor or the        processing unit may comprise, may be associated with or be        attached to a memory comprising the instructions, or    -   the association of a processor/processing unit and a memory, the        processor or the processing unit adapted to interpret        instructions in a computer language, the memory comprising said        instructions, or    -   an electronic card wherein the steps of the invention are        described within silicon, or    -   a programmable electronic chip such as a FPGA chip (for        <<Field-Programmable Gate Array>>).

This computer comprises an input interface 403 for the reception of theMCT image according to the invention and an output interface 406 forproviding the texture set or the adequate threshold.

The output interface 406 may be connected with:

-   -   another computation module 407 to determine petro/geo physical        properties of the rock sample;    -   a texture model database in order to store the determined        texture model (i.e. the set of three histograms described        above).

To ease the interaction with the computer, a screen 401 and a keyboard402 may be provided and connected to the computer circuit 404.

Expressions such as “comprise”, “include”, “incorporate”, “contain”,“is” and “have” are to be construed in a non-exclusive manner wheninterpreting the description and its associated claims, namely construedto allow for other items or components which are not explicitly definedalso to be present. Reference to the singular is also to be construed inbe a reference to the plural and vice versa.

A person skilled in the art will readily appreciate that variousparameters disclosed in the description may be modified and that variousembodiments disclosed may be combined without departing from the scopeof the invention.

For instance, the embodiments describe 2D images but the teachings mayalso be applied to 3D images.

The invention claimed is:
 1. A method for processing an image, saidimage representing a rock sample, wherein the method comprises: a)receiving said image; for each current threshold value in a plurality ofthreshold values: b) determining a threshold image, the threshold imagehaving pixels associated with a first color value or a second colorvalue, the determination of the threshold image being based on thereceived image and the current threshold; c) for each current connectedset of pixels associated with the first color value in the thresholdimage, determining a connected size of said current connected set ofpixels; d) determining at least one number of connected sets of pixelsassociated with the first color value for which the connected size isidentical; e) creating a plurality of histograms based on the determinedat least one number of connected sets of pixels associated with a colorvalue for which the connected size is identical; f) creating a texturemodel from the plurality of histograms; and g) classifying the rocksample based on the texture model.
 2. The method according to claim 1,wherein in the determination of step d), each set in said sets of pixelshave a connected size higher than a predetermined size; and wherein, themethod further comprises: h) determining a target threshold value basedon the determined numbers of connected sets of pixels having a connectedsize higher than the predetermined size.
 3. The method according toclaim 2, wherein the determination of the target threshold value isbased on a derivative of the determined numbers of connected sets ofpixels having a connected size higher than the predetermined size. 4.The method according to claim 1, wherein, the received image comprisingpixels associated with a set of pixel values, the method furthercomprises: h) for each current color value in the set of pixel values,determining a number of pixels in the pixels of the received imageassociated with said current color value; wherein for each currentthreshold value in a plurality of threshold values: c′) for each currentconnected set of pixels associated with the second color value in thethreshold image, determining a connected size of said current connectedset of pixels; d′) determining at least one number of connected sets ofpixels associated with the second color value for which the connectedsize is identical.
 5. A non-transitory computer readable storage medium,having stored thereon a computer program comprising programinstructions, the computer program being loadable into a data-processingdevice and adapted to cause the data-processing device to carry out thesteps of claim 1 when the computer program is run by the data-processingdevice.
 6. A device for processing an image, said image representing arock sample, wherein the device comprises: an input interface forreceiving said image; a circuit for, for each current threshold value ina plurality of threshold values, said circuit determining a thresholdimage, the threshold image having pixels associated with a first colorvalue or a second color value, the determination of the threshold imagebeing based on the received image and the current threshold; for eachcurrent connected set of pixels associated with the first color value inthe threshold image, determining a connected size of said currentconnected set of pixels; and determining at least one number ofconnected sets of pixels associated with the first color value for whichthe connected size is identical; creating a plurality of histogramsbased on the determined at least one number of connected sets of pixelsassociated with a color value for which the connected size is identical;creating a texture model from the plurality of histograms; andclassifying the rock sample based on the texture model.